package com.hl.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.mapper.PublicCenterMapper;
import com.hl.pojo.Consultanttraining;
import com.hl.pojo.Publicwelfarecenter;
import com.hl.util.GeneralResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PublicCenterServiceImpl implements PublicCenterService{
    @Autowired
    private PublicCenterMapper publicCenterMapper;
    @Override
    public PageInfo<Publicwelfarecenter> getPublicCenterMessage(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<Publicwelfarecenter> list = publicCenterMapper.getPublicCenterMessage();
        PageInfo<Publicwelfarecenter> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public GeneralResult shanChuPublicCenterMessage(Integer id) {
        Integer num = publicCenterMapper.shanChuPublicCenterMessage(id);
        return GeneralResult.message(200,"删除成功",num);
    }

    @Override
    public GeneralResult xiuGaiPublicCenterMessage(Publicwelfarecenter publicwelfarecenter) {
        Integer num = publicCenterMapper.xiuGaiPublicCenterMessage(publicwelfarecenter);
        return GeneralResult.message(200,"修改成功",num);
    }

    @Override
    public GeneralResult xinZengPublicCenterMessage(Publicwelfarecenter publicwelfarecenter) {
        Integer num = publicCenterMapper.xinZengPublicCenterMessage(publicwelfarecenter);
        return GeneralResult.message(200,"新增成功",num);
    }

    @Override
    public GeneralResult souSuoPublicCenterMessage(Publicwelfarecenter publicwelfarecenter) {
        List<Publicwelfarecenter> list = publicCenterMapper.souSuoPublicCenterMessage(publicwelfarecenter);
        System.out.println("搜索到的数据是！！！！！！！！！！！！！" + list);
        return GeneralResult.message(200,"搜索成功",list);
    }


}
